package de.lot.model;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.GeneratedValue;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.validator.Length;
import org.hibernate.validator.NotNull;

/**
 * LearningOutcome is the class to hold general information on an outcome,
 * such as:
 * <ul>
 * <li>the number
 * <li>the description
 * <li>the kind of assessement
 * <li>the time schedule
 * </ul>
 *
 * @see  Trait
 * @author Stefan Kohler <kohler.stefan@gmail.com>
 */

@Entity
@Table(name="LEARNINGOUTCOME")
public class LearningOutcome implements Serializable {
    
	private Long id;
	private Integer number;
	private String description;
    private String assessementTool;
    private String timeSchedule;
	private ProgramGoal programGoal;
    private Set<Trait> traitList = new HashSet<Trait>(0);

    @Id
    @GeneratedValue
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @NotNull
    public Integer getNumber() {
        return number;
    }

    public void setNumber(Integer number) {
        this.number = number;
    }

    @Length(max=400)
    @NotNull
    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @Length(max=300)
    @NotNull
    public String getAssessementTool() {
        return assessementTool;
    }

    public void setAssessementTool(String assessementTool) {
        this.assessementTool = assessementTool;
    }

    @Length(max=400)
    @NotNull
    public String getTimeSchedule() {
        return timeSchedule;
    }

    public void setTimeSchedule(String timeSchedule) {
        this.timeSchedule = timeSchedule;
    }

    @ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="PROGRAMGOAL_ID", nullable=false)
    @NotNull    
    public ProgramGoal getProgramGoal() {
        return programGoal;
    }

    public void setProgramGoal(ProgramGoal programGoal) {
        this.programGoal = programGoal;
    }

    @OneToMany(fetch=FetchType.LAZY, mappedBy="learningOutcome")
    public Set<Trait> getTraitList() {
        return traitList;
    }

    public void setTraitList(Set<Trait> traitList) {
        this.traitList = traitList;
    }
   
}
